using Aurora.Discovery.HttpClient.Abstractions;

namespace HttpClient.Options;

/// <summary>
/// http client options
/// </summary>
public class HttpClientOptions
{

    public bool UsePolicy { get; set; } = true;
    
    /// <summary>
    /// 重试次数
    /// </summary>
    public int RetryCount { get; set; } = 3;

    /// <summary>
    /// 熔断之前允许的异常次数
    /// </summary>
    public int ExceptionCountAllowedBeforeBreaking { get; set; } = 5;

    /// <summary>
    /// 熔断间隔秒数
    /// </summary>
    public int Seconds { get; set; } = 60;

    /// <summary>
    /// 请求的超时时间 单位秒
    /// </summary>
    public int TimeoutSecond { get; set; } = 30;

    /// <summary>
    /// 是否启用服务发现
    /// </summary>
    public bool UseDiscovery { get; set; } = false;


    /// <summary>
    /// 是否启用header传播
    /// </summary>
    public bool UseHeaderPropagation { get; set; } = true;

    /// <summary>
    /// header 传播的key
    /// </summary>
    public List<string> HeaderPropagations { get; set; } = new List<string>();


    /// <summary>
    /// 服务发现的配置
    /// </summary>
    public Action<DiscoveryOptions> DiscoveryAction { get; set; }
}